#define _CRT_SECURE_NO_WARNINGS
#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int begin, end;
        begin = end = 0;
        int count = 0;
        while (end < nums.size()) {
            if (nums[begin] != nums[end]) {
                begin = end;
                count++;
                nums[count] = nums[begin];
            }
            end++;
        }

        return count + 1;
    }
};
int main() {
    vector<int> v;
    v.push_back(0);
    v.push_back(0);
    v.push_back(0);
    v.push_back(1);
    v.push_back(1);
    v.push_back(1);
    v.push_back(2);
    v.push_back(2);
    v.push_back(3);
    v.push_back(3);
    v.push_back(4);
    Solution().removeDuplicates(v);
    return 0;
}